<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/context 
                           http://www.springframework.org/schema/context/spring-context.xsd">

	<!-- Define the controllers using annotations -->


	<!-- ******************* -->
	<!-- DB and Hibernate -->
	<!-- ******************* -->

	<!-- Aufruf der Java-Klasse Startup -->
	<!-- Klasse Startup im Package "de.hdu.pms" -->
	<bean class="de.hdu.pms.Startup" id="init" init-method="initDB">

		<!-- Einbindung des DB-Treibers in Programm -->
		<property name="driverClass" value="com.mysql.jdbc.Driver" />

		<!-- Standardzugriff auf Standard-DB für ersten Zugriff -->
		<property name="user" value="root" />
		<property name="password" value="" />
		<property name="defaultDBurl" value="jdbc:mysql://localhost:3306/mysql" />

		<!-- Anlegen der neuen, benötigten Datenbank -->
		<property name="newDB" value="worktimetest" />
	</bean>


	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
		destroy-method="close" depends-on="init">
		<property name="driverClass" value="com.mysql.jdbc.Driver" />
		<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/worktimetest" />
		<property name="user" value="root" />
		<property name="password" value="" />
		<property name="minPoolSize" value="2" />
		<property name="maxPoolSize" value="4" />
	</bean>


	<bean id="hibernateSessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="annotatedClasses">
			<list>

				<!-- Angabe der Klassen des Datenmodels -->
				<value>de.hdu.pms.model.Arbeitstag</value>
				<value>de.hdu.pms.model.Basis</value>
				<value>de.hdu.pms.model.Krankheit</value>
				<value>de.hdu.pms.model.Mitarbeiter</value>
				<value>de.hdu.pms.model.Pausen</value>
				<value>de.hdu.pms.model.Projekte</value>
				<value>de.hdu.pms.model.Projektzeit</value>
				<value>de.hdu.pms.model.Urlaub</value>
				<value>de.hdu.pms.model.Feiertage</value>


			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
			</props>
		</property>
	</bean>
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>

	<!-- ******************* -->
	<!-- Data Access Objects -->
	<!-- ******************* -->
	
	<bean id="basisDao" class="de.hdu.pms.dao.BasisDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	<bean id="projekteDao" class="de.hdu.pms.dao.ProjekteDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	<bean id="feiertageDao" class="de.hdu.pms.dao.FeiertageDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	<bean id="mitarbeiterDao" class="de.hdu.pms.dao.MitarbeiterDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	<bean id="krankheitDao" class="de.hdu.pms.dao.KrankheitDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	<bean id="urlaubDao" class="de.hdu.pms.dao.UrlaubDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	<bean id="arbeitstagDao" class="de.hdu.pms.dao.ArbeitstagDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	<bean id="pausenDao" class="de.hdu.pms.dao.PausenDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	<bean id="projektzeitDao" class="de.hdu.pms.dao.ProjektzeitDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
</beans>
	